<template>
	<div>
		<el-form ref="form" :model="form" label-width="80px">

			<el-form-item label="运行日期">
				<el-input v-model="form.runningDate"></el-input>
			</el-form-item>


			<el-form-item label="时间">
				<el-input v-model="form.time" value-format="HH:mm:ss" type="time"></el-input>
			</el-form-item>

			<el-form-item label="线路代号">
				<el-input v-model="form.lineCode"></el-input>
			</el-form-item>
			
			<el-form-item label="线路名称">
				<el-input v-model="form.lineName"></el-input>
			</el-form-item>
			
			<el-form-item label="途径">
				<el-input v-model="form.access"></el-input>
			</el-form-item>
			
			<el-form-item>
				<el-button type="primary" @click="save">保存</el-button>
			</el-form-item>
		</el-form>

	</div>
</template>

<script>
	export default {
		name: 'ShuttleRouteEdit',
		components: {
			
		},
		props: [
			'show',
			'editid'
		],
		data() {
			return {
				form: {
					id: '',
					runningDate: '',
					time: '',
					lineCode: '',
					
					lineName: '',
					access:''
				},
				depts:[],
				registLevels:[]
				// depts:[
				// 	{id:1,name:'肾内科'},
				// 	{id:2,name:'消化内科'}
				// ],
				// registLevls:[
				// 	{id:1,name:'专家'},
				// 	{id:2,name:'教授'}
				// ]
			}
		},
		created() {
			if (this.editid){
				this.show = true;
				this.$axios.get(
					'shuttleRoute/update',
					response=> {
						this.form.id = this.editid;
						this.form.runningDate = response.obj.runningDate;
						this.form.time = response.obj.time;
						this.form.lineCode = response.obj.lineCode;
						this.form.lineName = response.obj.lineName;
						this.form.access = response.obj.access;
					},{
						id: this.editid
					}
				)
			}
		},
		
		methods: {
			save() {
				this.axios.get('/shuttleRoute/toAdd', (data) => {
					if (data) {
						this.$emit('update:show', false)
						this.$emit('getData')
					}

				}, this.form, '保存成功');
			},
		// 	loadData(){
		// 		//加载机构列表
		// 		this.axios.get('/dept?type=listAll', (data) => {
		// 			this.depts = data;
		// 		});
				
		// 		//加载机构列表
		// 		this.axios.get('/regist_level?type=queryList', (data) => {
		// 			this.registLevels = data;
		// 		});
		// 	}
			
			
			
		// },
		// created() {

		// 	if (this.userId) {
		// 		//当修改的时候 需要根据用户的 id， 将数据查询到页面
		// 		this.axios.get('/user?type=toEdit', (data) => {
		// 			this.form = data;
		// 		}, {
		// 			userId: this.userId
		// 		});
		// 	}
			
			//加载 科室、挂号级别信息
			// this.loadData();

		}
	}
</script>

<style>
</style>
